package org.flowers.unbeaten.base.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 部门
 * </p>
 *
 * @author RyanWang
 * @since 2021-07-15
 */
@Data
@TableName("department")
public class Department extends Model<Department> {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @TableId(value = "department_id", type = IdType.ASSIGN_ID)
    private String departmentId;

    /**
     * 部门名称
     */
    @TableField("department_name")
    private String departmentName;

    /**
     * 部门编号
     */
    @TableField("department_code")
    private String departmentCode;

    /**
     * 父级ID
     */
    @TableField("parent_id")
    private String parentId;

    /**
     * 部门层级
     */
    @TableField("path")
    private String path;

    /**
     * 状态 0.禁用 1.正常
     */
    @TableField("status")
    private Integer status;

    /**
     * 是否删除 0.删除 1.未删除
     */
    @TableField("deleted")
    private Integer deleted;

    /**
     * 创建时间
     */
    @TableField("create_time")
    private LocalDateTime createTime;

    /**
     * 更新时间
     */
    @TableField("update_time")
    private LocalDateTime updateTime;

    /**
     * 部门子集数量
     */
    @TableField(exist = false)
    private Integer children;

    @Override
    protected Serializable pkVal() {
        return this.departmentId;
    }
}
